#include "pid_parameters.h"

#include "base_drv/drv_conf.h"
/*PID参数文件*/
//chassis pid
//------------------------------------------------------------------------------------------
const steering_pid_struct_t steering_rpm_pid_int_val={
	 .kp = 20.0f,
   .ki = 0.0f,
   .kd=0.0f,
   .i_max=C620_OUTPUT_MAX/50,
   .out_max=C620_OUTPUT_MAX/1.5,
   .k_deadband=0.0f 
};

const steering_pid_struct_t steering_ang_pid_int_val={
	.kp = 1.0f,
	.ki = 0.00f,
	.kd = 0.0f,
	.i_max = GM6020_OUTPUT_MAX/100,
	.out_max = GM6020_OUTPUT_MAX/10,
	.k_deadband = 0.0f
};


const pid_struct_t wheels_pid_init_val={
	.kp = 28.0f,
	.ki = 0.1f,
	.kd = 14.4f,
	.i_max = C620_OUTPUT_MAX/10,
	.out_max = C620_OUTPUT_MAX,
	.k_deadband = 0.0f
};

const pid_struct_t chassis_vx_pid_init_val={
	.kp = 35.0f,
	.ki = 0.15f,
	.kd = 0.8f,
	.i_max = C620_OUTPUT_MAX/10,
	.out_max = C620_OUTPUT_MAX,
	.k_deadband = 0.005f
};

const pid_struct_t chassis_vy_pid_init_val={
	.kp = 35.0f,
	.ki = 0.15f,
	.kd = 0.8f,
	.i_max = C620_OUTPUT_MAX/10,
	.out_max = C620_OUTPUT_MAX,
	.k_deadband = 0.005f
};
const pid_struct_t chassis_wz_pid_init_val={
	.kp = 10.0f,
	.ki = 0.02f,
	.kd = 0.0f,
	.i_max = C620_OUTPUT_MAX/80,
	.out_max = C620_OUTPUT_MAX,
	.k_deadband = 0.001f,
};

const pid_struct_t chassis_follow_pid_init_val={
	.kp = 0.05f,
	.ki = 3e-5f,
	.kd = 0.02f,
	.i_max = 5,
	.out_max = 50,
	.k_deadband = 100.0f,
	.deadband_zero_output = 1
};

//gimbal motor pid
//------------------------------------------------------------------------------------------

const pid_struct_t yaw_pid_ang_loop={
	.kp = 1.0f,
	.ki = 0.0f,
	.kd = 0.0f,
	.i_max = GM6020_OUTPUT_MAX/100,
	.out_max = GM6020_OUTPUT_MAX/10,
	.k_deadband = 0.0f
};
const pid_struct_t yaw_pid_rpm_loop={
	.kp = 200.0f,
	.ki = 0.00f,
	.kd = 0.0f,
	.i_max = GM6020_OUTPUT_MAX/10,
	.out_max = GM6020_OUTPUT_MAX,
	.k_deadband = 0.0f
};

const pid_struct_t pitch_pid_ang_loop={
	.kp = 0.220f,
	.ki = 0.001f,
	.kd = 0.45f,
	.i_max = GM6020_OUTPUT_MAX/100,
	.out_max = GM6020_OUTPUT_MAX/10,
	.k_deadband = 0.0f
};
const pid_struct_t pitch_pid_rpm_loop={
	.kp = 200.0f,
	.ki = 0.001f,
	.kd = 0.001f,
	.i_max = GM6020_OUTPUT_MAX/10,
	.out_max = GM6020_OUTPUT_MAX,
	.k_deadband = 0.0f
};

//gimbal imu pid
//------------------------------------------------------------------------------------------

const pid_struct_t yaw_imu_pid_ang_loop={
//	.kp = 0.35f,
//	.ki = 1e-07f,
//	.kd = 0.35f,
	.kp = 0.5f,//0.3f,        
	.ki = 1e-5f,//0.0f       
	.kd = 0.05f,  
	.i_max = GM6020_OUTPUT_MAX/100,
	.out_max = GM6020_OUTPUT_MAX/10,
	.k_deadband = 0.0f
};
const pid_struct_t yaw_imu_pid_rpm_loop={
//	.kp = 600.0f,
//	.ki = 0.02f,
//	.kd = 0.0f,
	.kp = 600.0f,   
	.ki = 1e-5f,
	.kd = 0.0f,
	.i_max = GM6020_OUTPUT_MAX/10,
	.out_max = GM6020_OUTPUT_MAX,
	.k_deadband = 0.0f
};

const pid_struct_t pitch_imu_pid_ang_loop={
	.kp = 0.8f,
	.ki = 0.0001f,
	.kd = 0.1f,
	.i_max = 2.5f,
	.out_max = GM6020_OUTPUT_MAX/10,
	.k_deadband = 0.0f
};
const pid_struct_t pitch_imu_pid_rpm_loop={
	.kp = 300.0f,
	.ki = 0.0001f,
	.kd = 0.8f,
	.i_max = GM6020_OUTPUT_MAX/10,
	.out_max = GM6020_OUTPUT_MAX,
	.k_deadband = 0.0f
};

//shoot pid
//------------------------------------------------------------------------------------------

const pid_struct_t shoot_fric_pid_init_val={
//	.kp = 6.0f,
//	.ki = 0.012f,
//	.kd = 2.5f,
	.kp = 7.4f,      //3.6
	.ki = 0.0f,    //1e-005f
	.kd = 5.8f,      //12.0
	.i_max = C620_OUTPUT_MAX/100,
	.out_max = C620_OUTPUT_MAX/2,
	.k_deadband = 0.0f
};

const pid_struct_t bullet_push_pid_init_val={
	.kp = 12.0f,
	.ki = 0.4f,
	.kd = 0.03f,
	.i_max = C610_OUTPUT_MAX/10,
	.out_max = C610_OUTPUT_MAX/2,
	.k_deadband = 0.0f
};


//power limit pid
//------------------------------------------------------------------------------------------
const pid_struct_t power_limit_pid_init_val ={
	.kp = 4.9f,
	.ki = 0.25f,
	.kd = 0.3f,
	.i_max = C620_OUTPUT_MAX/350,
	.out_max = C610_OUTPUT_MAX/100,
	.k_deadband = 0.0f
};

const pid_struct_t power_cap_pid_init_val ={
	.kp = 4.9f,
	.ki = 0.3f,
	.kd = 0.0f,
	.i_max = C620_OUTPUT_MAX/350,
	.out_max = C610_OUTPUT_MAX/100,
	.k_deadband = 0.0f
};

const pid_struct_t power_limit_pid_Nban_init_val ={
	.kp = 0.3f,
	.ki = 0.001f,
	.kd = 0.0f,
	.i_max = 1,
	.out_max = C610_OUTPUT_MAX/100,
	.k_deadband = 0.0f
};
//barrel switch pid
//------------------------------------------------------------------------------------------
const pid_struct_t switch_move_pid_init_val ={
	.kp = 5.0f,
	.ki = 0.0f,
	.kd = 1.0f,
	.i_max = 1,
	.out_max = C610_OUTPUT_MAX,
	.k_deadband = 0.0f
};

const pid_struct_t switch_stop_pid_ang_loop ={
	.kp = 3.0f,
	.ki = 0.0f,
	.kd = 12.0f,
	.i_max = 1,
	.out_max = C610_OUTPUT_MAX,
	.k_deadband = 0.0f
};

const pid_struct_t switch_stop_pid_rpm_loop ={
	.kp = 1.0f,
	.ki = 0.0f,
	.kd = 0.0f,
	.i_max = 1,
	.out_max = C610_OUTPUT_MAX,
	.k_deadband = 0.0f
};

